﻿@model ECatalog.Models.Organizations.OrganizationViewModel
<div class="container">
    <div class="row col-lg-3">
        @using (Html.BeginForm("Edit", "Organization", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>Редактирование организации</legend>

                @Html.HiddenFor(model => model.Organization.OrganizationId)
                @Html.HiddenFor(model=>model.Organization.TypeImage)
                @Html.HiddenFor(model=>model.Organization.LogoUrl)
                <div class="editor-label">
                   Название
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(model => model.Organization.Name,new {@class="form-control"})
                    @Html.ValidationMessageFor(model => model.Organization.Name)
                </div>

                <div class="editor-label">
                    Описание
                </div>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Organization.Description,new {@class="form-control"})
                    @Html.ValidationMessageFor(model => model.Organization.Description)
                </div>
                <div class="editor-field">
                     @{
                            var imageUrl = "";
                            if (Model != null)
                            {
                                imageUrl = string.Format("/Files/Organization-{0}/Logo-{1}/320x240/{2}{3}", @Model.Organization.OrganizationId, @Model.Organization.LogoUrl, @Model.Organization.LogoUrl,@Model.Organization.TypeImage);
                            }
                        }
                        <img class="photo-block" src="@imageUrl" alt="" />
                    <input type="file" name="UploadedFile" id="UploadedFile" class="form-control" />
                </div>
                <br/>
                <p>
                    <input type="submit" value="Сохранить" class="btn btn-primary"  />
                </p>
            </fieldset>
        }
        <div>
            @Html.ActionLink("Назад", "Index")
        </div>
    </div>
</div>
